<template>
  <view class="rule-page">
    <!-- 有效期 -->
    <view class="rule-item">
      <view class="rule-title">有效期</view>
      <view class="rule-content">01月14日前使用</view>
      <button class="remove-button" @click="removeRule('validity')">删除</button>
    </view>

    <!-- 可用时间 -->
    <view class="rule-item">
      <view class="rule-title">可用时间</view>
      <view class="rule-content">11:00--22:00(周末节假日通用)</view>
      <button class="remove-button" @click="removeRule('availability')">删除</button>
    </view>

    <!-- 使用规则 -->
    <view class="rule-item">
      <view class="rule-title">使用规则</view>
      <view class="rule-content">
        店内无包间发票问题请询问商家，本单发票由商家提供，请在消费时向商家索取商家提供免费WiFi停车位收费标准:咨询商家仅限堂食，不提供餐前外卖餐毕未吃完可免费打包团购用户不可同时享受商家其他优惠酒水饮料等问题，请致电商家咨询，以商家反馈为准不找现、不找零无需预约。
      </view>
      <button class="remove-button" @click="removeRule('rules')">删除</button>
    </view>

    <!-- 添加规则 -->
    <view class="rule-item add-rule">
      <view class="rule-title add-rule-title">请输入标题</view>
      <textarea placeholder="请输入内容" v-model="newRuleTitle"></textarea>
      <button class="add-button" @click="addRule">添加规则</button>
    </view>

    <!-- 确认按钮 -->
    <button class="confirm-button" @click="confirmRules">确认</button>
  </view>
</template>

<script>
export default {
  data() {
    return {
      newRuleTitle: '',
    };
  },
  methods: {
    removeRule(type) {
    },
    addRule() {
    },
    confirmRules() {
    }
  }
};
</script>

<style scoped>
.rule-page {
  padding: 20px;
}

.rule-item {
  margin-bottom: 20px;
  border: 1px solid #ddd;
  padding: 10px;
  border-radius: 5px;
  position: relative;
  min-height: 100px;
}

.rule-title {
  font-weight: bold;
  margin-bottom: 5px;
}

.rule-content {
  word-break: break-all;
  margin-bottom: 30px;
  background-color: #f0f0f0; /* 添加灰色背景 */
  padding: 10px; /* 添加内边距 */
  border-radius: 5px; /* 添加圆角 */
}

.remove-button {
  background-color: #ff6347;
  color: white;
  border: none;
  /* padding: 5px 10px; */
  border-radius: 5px;
  cursor: pointer;
  /* position: absolute; */
  width: 100px;
  bottom: 10px;
  left: 100px;
}

.add-rule {
  margin-top: 20px;
}

.add-rule-title {
  margin-bottom: 10px;
}

.add-button {
  background-color: #4CAF50;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
}

.confirm-button {
  background-color: #007bff;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  width: 100%;
  margin-top: 20px;
}
</style>